package com.example.websocket.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ author 韩
 * time: 2024/3/13 20:38
 */

@Mapper
public interface MessageMapper {

    @Select("select message_name from `message` where username = #{username}")
    List<String> getMessageList(String username);

    @Insert("insert into `message` values (null,#{username},#{message_name})")
    Boolean addMessage(String username, String message_name);

    @Select("SELECT message_name from `message` where username = #{username} AND message_name LIKE CONCAT('%', #{key}, '%')")
    List<String> getMessage(String username, String key);
}
